<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class model_slide extends CI_Model{
    var $table      = "tbl_slideshow";
    var $primary    = "id_slide";
    
    public function __construct(){
        parent::__construct();
    }
    function get_all(){
        return $this->db->get($this->table);
    }
    function save($isi){
        if(empty($isi)){return FALSE;}
        if($this->db->insert($this->table,$isi)) {return TRUE;}
        else {return FALSE;}
    }
    function delete($id){
        if($this->db->delete($this->table, array($this->primary => $id))) return true;
        else return false; 
    }
    function update($id,$array){
	   $this->db->where($this->primary,$id);	
       if($this->db->update($this->table,$array)) return true;
       else return false;
    }
    function select_by_id($id,$mod="result"){
        $q = $this->db->query("SELECT * FROM `".$this->table."` WHERE `".$this->primary."` = '".$id."'");
        if(strtolower($mod) == "result") return $q->result();
        else return $q->num_rows();
    }
}
/* End of file model_slide.php */
/* Location: ./application/models/model_slide.php */
